<?php
class Form_Connexion extends Zend_Form{
	public function init(){
		$this->setMethod('post');
		$this->setName('connexion');
		
		$connexionLogin = $this->createElement('text', 'login');
		$connexionLogin	->setLabel("Login : ")
						->addFilter('StripTags')
						->addValidator('alnum', false, array('allowWhiteSpace'=>false))
						->addFilter('StringTrim')
						->setRequired(TRUE);
		$connexionPass = $this->createElement('password', 'pass');
		$connexionPass	->setLabel("Pass : ")
						->setRequired(TRUE);
		$submit = new Zend_Form_Element_Submit('submit');
		$submit->setLabel('Se connecter');
		
		//on ajoute tout les elements d'un seul coup
		$this->addElements(array($connexionLogin,$connexionPass,$submit));
		
		//On modifie les styles par default
		$this->clearDecorators();
		
		$this->setElementDecorators(array('ViewHelper','Description','Errors',
                   array(array('data'=>'HtmlTag'), array('tag' => 'td')),
                   array('Label', array('tag' => 'td')),
                   array(array('row'=>'HtmlTag'),array('tag'=>'tr'))));
        
		$submit->setDecorators(array(
				'ViewHelper','Description','Errors', array(array('data'=>'HtmlTag'),
				array('tag' => 'td','colspan'=>'2','align'=>'left')),
				array(array('row'=>'HtmlTag'),array('tag'=>'tr'))
       ));
		
		$this->setDecorators(array('FormElements', array(array('data'=>'HtmlTag'),array('tag'=>'table')),'Form'));
		
		
	}
}